<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return '你访问的是hello地址';
});
Route::get('/home', function () {
    return '您当前访问的是/home地址';
});

// 必选参数   h1
Route::get('/home1/{id}', function ($id) {
    return '接收到的id是' . $id;
})->name('h1');

//默认参数
Route::get('/home2/{id?}', function ($id) {
    return '接收到的id是' . $id;
});

//传统参数传递
Route::get('/home3', function () {
    return '接收到的id是' . $_GET['id'];
});

//路由群组
Route::group(['prefix' => 'home/test'], function () {
    Route::get('test1', function () {
        return 'a';
    });
    Route::get('test2', function () {
        return 'b';
    });
});

Route::get('/test1', 'TestController@test1');

Route::get('/test2', 'TestController@test2');

//DB的CURD
Route::get('/add', 'TestController@add');//增加
Route::get('/del', 'TestController@del');//删除
Route::get('/mod', 'TestController@mod');//修改
Route::get('/select', 'TestController@select');//查询

//视图测试
Route::get('/test3','TestController@test3');
Route::get('/test4','TestController@test4');
Route::get('/test5','TestController@test5');

//csrf测试
Route::get('/test6','TestController@test6');
Route::post('/test7','TestController@test7')->name('t7');

//模型使用
Route::post('model_add','TestController@model_add');
Route::get('model_del','TestController@model_del');
Route::get('model_mod','TestController@model_mod');
Route::get('model_select','TestController@model_select');

Route::get('test8','TestController@test8');
Route::post('test9','TestController@test9');

//分页测试
Route::get('test10','TestController@test10');

//json响应
Route::get('test11','TestController@test11');

//Session
Route::get('test12','TestController@test12');

//缓存
Route::get('test13','TestController@test13');


//联表查询
Route::get('test14','TestController@test14');

//关联关系1v1
Route::get('test15','TestController@test15');

//关联关系1vn
Route::get('test16','TestController@test16');

//关联关系nvn
Route::get('test17','TestController@test17');